import { createRouter, createWebHistory } from 'vue-router'
import UserRegsiterView from '../views/User/UserRegsiterView'
import UserLoginView from '../views/User/UserLoginView'

import PostIndexView from '../views/Post/PostIndexView'
import PostDetailView from '../views/Post/PostDetailView'
import PostArticleConfig from '../views/Utils/PostArticleConfig'
import PostCategoryView from '../views/Post/PostCategoryView'

import PersonalConfig from '../views/Utils/PersonalConfig'
import PersonalStars from '../views/Utils/PersonalStars'
import PersonalMessage from '../views/Utils/PersonalMessage'

const routes = [
    {
        path: '/',
        name: 'home'
    },
    {
        // 用户注册
        path: '/user/register/',
        name: "UserRegsiterView",
        component: UserRegsiterView
    },
    {
        // 用户登录
        path: '/user/login/',
        name: "UserLoginView",
        component: UserLoginView
    },
    {
        // 论坛主页
        path: '/post/index/',
        name: "PostIndexView",
        component: PostIndexView
    },
    {
        // 文章分类
        path: '/post/category/:cid',
        name: "PostCategoryView",
        component: PostCategoryView
    },
    {
        // 文章详情
        path: '/post/detail/:id',
        name: "PostDetailView",
        component: PostDetailView
    },
    {
        // 个人中心
        path: '/cofig/personal/',
        name: "PersonalConfig",
        component: PersonalConfig
    },
    {
        // 我要发帖
        path: '/cofig/create/',
        name: "PostArticleConfig",
        component: PostArticleConfig
    },
    {
        // 我的收藏
        path: '/cofig/stars/',
        name: "PersonalStars",
        component: PersonalStars
    },
    {
        // 我的私信
        path: '/cofig/message/',
        name: "PersonalMessage",
        component: PersonalMessage
    }
    // {
    //     path: '/myspace/404/',
    //     name: '404',
    //     component: NotFoundView
    // },
    // {
    //     path: '/myspace/:catchAll(.*)',
    //     redirect: "/myspace/404/"
    // }
]

const router = createRouter({
    history: createWebHistory(),
    routes
})

export default router